package strategy_pattern;

import strategy_pattern.impl.AggressiveBehavior;
import strategy_pattern.impl.DefensiveBehavior;
import strategy_pattern.impl.NormalBehavior;

/**
 * @author 申书航
 * @version 1.0
 *
 * Client类负责执行游戏主循环，管理冒险者的行为模式。
 */
public class Client {

    /**
     * main方法是程序的入口，创建冒险者并控制游戏循环。
     */
    public static void main(String[] args) {
        Adventurer adventurer = new Adventurer(new NormalBehavior());
        mainLoop:
        do {
            switch (adventurer.explore()) {
                case DEAD :
                    System.out.println("游戏结束");
                    break mainLoop;
                case CLEAR:
                case STRONG_ENEMY:
                    adventurer.setBehavior(new DefensiveBehavior());
                    break;
                case WEAK_ENEMY:
                    adventurer.setBehavior(new AggressiveBehavior());
                    break;
                case MISTAKE:
                    adventurer.setBehavior(new DefensiveBehavior());
                    break;
                case NORMAL:
                    adventurer.setBehavior(new NormalBehavior());
                    break;
                default:
                    break;
            }
        } while (true);
    }
}

